package com.training.admin.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.training.admin.entity.project.Project;
import com.training.admin.entity.project.ProjectPhase;
/**
 * 
 * @author Rockett
 *
 */
@Dao("hibernate")
public interface ProjectPhaseDao {
	
	/**
	 * 
	 * @param projectId
	 * @return
	 */
	@Query("FROM ProjectPhase WHERE disabled = false and project.id =:projectId")
	public List<ProjectPhase> listByProjectId(@Variable("projectId") Long projectId);

	@Query("DELETE FROM ProjectPhase WHERE disabled = false and project.id =:projectId")
    public void deleteProjectPhase(ProjectPhase projectPhase);

    /**
     * @param project
     * @return
     */
	@Query("FROM ProjectPhase WHERE disabled = false and project = :project ORDER BY phase ASC")
    public List<ProjectPhase> listByProject(@Variable("project") Project project);
	
}
